﻿/*******************************************************************************
 * Copyright © 2016
 * 
 * Description: MVC快速开发平台  FROM http://xmwxgn.com
 *
*********************************************************************************/
using ZFine.Application.SystemManage;
using ZFine.Code;
using ZFine.Domain.Entity.SystemManage;
using System.Collections.Generic;
using System.Text;
using System.Web.Mvc;
using ZFine.Application.Gas;
using ZFine.Domain.Entity.Gas;
using ZFine.Application.Enum.Gas;
using System;

namespace ZFine.Web.Controllers
{
    [HandlerLogin]
    public class HomeController : Controller
    {
        private ResidentApp residentApp = new ResidentApp();
        private FaceRecordApp faceRecordApp = new FaceRecordApp();
        private DiningRecordApp diningRecordApp = new DiningRecordApp();
        [HttpGet]
        public ActionResult Index()
        {
            return View();
        }
        [HttpGet]
        public ActionResult Default()
        {
            DefaultDisplay display = new DefaultDisplay();
            display.ResidentCount = residentApp.GetCount();
            display.FaceRecordMonth = faceRecordApp.GetCount(DateTime.Now.Year, DateTime.Now.Month);
            display.FaceRecordYear = faceRecordApp.GetCount(DateTime.Now.Year);
            display.FaceRecordDay = faceRecordApp.GetCount(DateTime.Now.Year, DateTime.Now.Month,DateTime.Now.Day);
            display.FaceCountByMonth =  faceRecordApp.GetCountGroupByMonth();
            display.DiningRecordMonth = diningRecordApp.GetCount(DateTime.Now.Year, DateTime.Now.Month);
            display.DiningRecordYear = diningRecordApp.GetMonthAmount( DateTime.Now.Year, DateTime.Now.Month);
            List<string> diningListByMonth = diningRecordApp.GetCountGroupByMonth();
            List<string> faceListByWeek = faceRecordApp.GetCountGroupByWeek();
            display.DisplayMonth = diningListByMonth[0];
            display.DiningCountByMonth = diningListByMonth[1];
            display.DisplayDay = faceListByWeek[0];
            display.FaceCountByDay = faceListByWeek[1];
            display.FaceTotalOnWeek = faceListByWeek[2];
            ViewBag.Display = display;
            display.SatisfactionByMonth = faceRecordApp.GetSatisfactionByMonth();
            return View();
        }
        [HttpGet]
        public ActionResult About()
        {
            return View();
        }
    }
}
